/*******************************************************************************
* company    : 六瓜编程 2010-2020
* description:  lg_motor
* date: 2020-12-10 00:17:49
* author : XiaoShengYang
*******************************************************************************/

#ifndef __LG_MOTOR_H
#define __LG_MOTOR_H
#include <lg_types.h>

enum wheel_offset {
    WHEEL_LEFT = 0,
    WHEEL_RIGHT,
    WHEEL_NUM_MAX,
};

enum wheel_dir {
    DIR_FORWARD = 0,
    DIR_BACKWARD,
    DIR_NUM_MAX,
};

typedef lg_void (*motor_callback)(lg_void *motor_data);

/* motor */
lg_void lg_motor_set_frequecy(enum wheel_offset wheel, lg_u32 frequecy);
lg_void lg_motor_set_duty_cycle(enum wheel_offset wheel, lg_u32 duty_cycle);
lg_bool lg_motor_init(lg_void);
lg_bool lg_motor_deinit(lg_void);

/* wheel */
lg_void lg_motor_wheel_set_dir(enum wheel_offset wheel, enum wheel_dir dir);
lg_void lg_motor_wheel_set_speed(enum wheel_offset wheel, lg_u32 speed);

/* 注册回调函数 */
lg_u32 lg_motor_callback_register(motor_callback *callback);

/* 触发任务 */
lg_void lg_motor_task_triger(hi_void);

#endif